﻿using Abp.Web.Mvc.Authorization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WanFang.Test;
using WanFang.Web.Controllers;

namespace WanFang.Web.Controller
{
    [AbpMvcAuthorize]
    public class TestController : WanFangControllerBase
    {
        private IPersonService _service;
        public TestController(IPersonService service)
        {
            _service = service;
        }
        // GET: Test
        public ActionResult List()
        {
            return View(_service.GetList());
        }

        public ActionResult Add()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Add(Person entity)
        {
            _service.Add(entity);
            return Json(new ResultMsg());
        }
        public ActionResult Update(int id)
        {
            return View(_service.Get(id));
        }
        [HttpPost]
        public ActionResult Update(Person entity)
        {
            _service.Update(entity);
            return Json(new ResultMsg());
        }
        [HttpPost]
        public ActionResult Delete(int id)
        {
            _service.Delete(id);
            return Json(new ResultMsg());
        }
    }
}